package multithreading;

import java.util.concurrent.ArrayBlockingQueue;

public class CookB extends Thread {
    ArrayBlockingQueue<Integer> queue;

    public CookB(ArrayBlockingQueue<Integer> queue) {
        this.queue = queue;
    }

    @Override
    public void run() {
        while (true) {
            try {
                queue.put(Desk.count);
                System.out.println(Thread.currentThread().getName() + "cooking No." + (11 - Desk.count));
                Desk.count--;
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
